<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title></title>
    <script type="text/javascript" src="<%=path %>/static/js/jquery.js"></script>
    <script type="text/javascript" src="<%=path %>/static/js/mobile-detect.min.js"></script>
</head>
<body>
   <script>
      $(function(){
         var u = navigator.userAgent;
         var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
         var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
         var DeviceType="";
         if(isAndroid){
            DeviceType="安卓";
         }
         if(isiOS){
            DeviceType="苹果";
         }

         //判断数组中是否包含某字符串
         Array.prototype.contains = function(needle) {
            for (i in this) {
               if (this[i].indexOf(needle) > 0)
                  return i;
            }
            return -1;
         }

         var device_type = navigator.userAgent;//获取userAgent信息

         var md = new MobileDetect(device_type);//初始化mobile-detect
         var os = md.os();//获取系统
         var model = "";
         if (os == "iOS") {//ios系统的处理
            os = md.os() + md.version("iPhone");
            model = md.mobile();
         } else if (os == "AndroidOS") {//Android系统的处理
            os = md.os() + md.version("Android");
            var sss = device_type.split(";");
            var i = sss.contains("Build/");
            if (i > -1) {
               model = sss[i].substring(0, sss[i].indexOf("Build/"));
            }
         }


         $.getJSON("<%=path %>/wechat/tool/read.htmls",{taskid:"${param.taskid}",inviter:"${param.inviter}",iscontinue:"${param.iscontinue}",from:"${param.from}",DeviceType:DeviceType,OperSys:os},function(data){
             if(data.url!=undefined){
                location.href=data.url;
             }
             else{
                location.href=data.msg;
             }
         });

      });
   </script>
</body>
</html>
